package com.oig.sys.workflow.dao;

import com.oig.sys.workflow.entity.TbFlowForm;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

/**
 * @author wuxl
 */
public interface ITbFlowFormDao extends JpaRepository<TbFlowForm, Integer> {

	TbFlowForm getTbFlowFormById(Integer id);

	TbFlowForm getByFlowConfigIdAndFieldId(Integer flowConfigId, String fieldId);

	List<TbFlowForm> findByFlowConfigIdAndParentId(Integer flowConfigId, Integer parentId);

	@Query("select d.id from TbFlowForm d where d.id not in(:idList) and d.parentId=:parentId and d.flowConfigId=:flowConfigId")
	List<Integer> findAllDelId(@Param("flowConfigId") Integer flowConfigId, @Param("parentId")Integer parentId, @Param("idList") List<Integer> idList);


	@Query(" from TbFlowForm d where d.id in(:idList)")
	List<TbFlowForm> findByIdList(@Param("idList") List<Integer> idList);

}
